package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.MerchantGiftPacketProduct;
import com.rockcent.mall.lib.domain.enumclass.GiftPacketProductType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by DK on 16/10/11.
 */
@Repository
public interface MerchantGiftPacketProductRepository extends MerchantGiftPacketProductRepositoryCustom,JpaRepository<MerchantGiftPacketProduct, Long>, JpaSpecificationExecutor {
    void deleteByPacketId(Long packetId);

    List<MerchantGiftPacketProduct> findByProductId(Long productId);

    List<MerchantGiftPacketProduct> findByProductIdAndGiftPacketProductType(Long productId, GiftPacketProductType type);

    List<MerchantGiftPacketProduct> findByPacketIdAndIsDelete(Long packetId, Whether whether);

    List<MerchantGiftPacketProduct> findByPacketIdInAndIsDelete(List<Long> giftGiftPacketPageIdList, Whether no);
}
